package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

/**
　　* @description: 候选关系枚举实体
　　* @author shenrm
　　* @date 2021/11/4 9:16
　　*/
public enum CandidateRelationShipEnum {

    /**
     * 拟稿人
     */
    NGR("0", "拟稿人"),

    /**
     * 拟稿人部门
     */
    NGRBM("1", "拟稿人部门"),

    /**
     * 当前人部门
     */
    DQRBM("2", "当前人部门");

    CandidateRelationShipEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 编码
     */
    private String code;

    /**
     * 名称
     */
    private String name;


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static CandidateRelationShipEnum fromName(String name) {
        for (CandidateRelationShipEnum shipEnum : CandidateRelationShipEnum.values()) {
            if (shipEnum.name.equals(name)) {
                return shipEnum;
            }
        }
        return null;
    }

    public static CandidateRelationShipEnum fromCode(String code) {
        for (CandidateRelationShipEnum shipEnum : CandidateRelationShipEnum.values()) {
            if (shipEnum.code.equals(code)) {
                return shipEnum;
            }
        }
        return null;
    }
}
